using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace ZYCommon
{
    public class PageLineInfo
    {
        private bool bolModified = false;
        private int intFirstPos = 0;
        private int intLastPos = 0;
        private int intMinPageHeight = 0;
        private int intPageIndex = 0;
        private int intPos = 0;

        public PageLineInfo(int vFirstPos, int vLastPos, int vPos, int vPageIndex)
        {
            this.intFirstPos = vFirstPos;
            this.intLastPos = vLastPos;
            this.intPos = vPos;
            this.intPageIndex = vPageIndex;
        }

        public bool CanSet(int vPos)
        {
            if ((vPos > this.intLastPos) && (vPos < this.intPos))
            {
                if ((this.intMinPageHeight > 0) && ((vPos - this.intLastPos) < this.intMinPageHeight))
                {
                    return false;
                }
                return true;
            }
            return false;
        }

        public bool Match(Rectangle rect)
        {
            return ((this.intPos >= rect.Top) && (this.intPos < rect.Bottom));
        }

        public bool Match(int Top, int Bottom)
        {
            return ((this.intPos >= Top) && (this.intPos < Bottom));
        }

        public int FirstPos
        {
            get
            {
                return this.intFirstPos;
            }
        }

        public int LastPos
        {
            get
            {
                return this.intLastPos;
            }
        }

        internal int MinPageHeight
        {
            get
            {
                return this.intMinPageHeight;
            }
            set
            {
                this.intMinPageHeight = value;
            }
        }

        public bool Modified
        {
            get
            {
                return this.bolModified;
            }
            set
            {
                this.bolModified = value;
            }
        }

        public int PageIndex
        {
            get
            {
                return this.intPageIndex;
            }
        }

        public int Pos
        {
            get
            {
                return this.intPos;
            }
            set
            {
                if (((value > this.intLastPos) && (value < this.intPos)) && ((this.intMinPageHeight <= 0) || ((value - this.intLastPos) >= this.intMinPageHeight)))
                {
                    this.intPos = value;
                    this.bolModified = true;
                }
            }
        }
    }
}
